(function(){
    const options = {
        el: document.getElementById('game'),
        level: 'easy'
    }

    const initGame = new Minesweeper(options)

    initGame.initGame()

    const form = document.getElementById('level')
    const radio = form.getElementsByClassName('level-radio')
    for(let i = 0; i < radio.length; i++) {
        radio[i].addEventListener('change', function() {
            const game = new Minesweeper({
                el: document.getElementById('game'),
                level: this.value
            })
            game.initGame()
        }, false)
    }
}())